// mutations唯一的目的就是修改state中的状态
// mutations中的每个方法尽量完成的事件单一

import { addCart } from '../network/cart'
import {
  ADD_COUNTER,
  ADD_TO_CART
} from './mutation-types'

export default {
  [ADD_COUNTER](state,payload){
    payload.count++
  },
  [ADD_TO_CART](state,payload){
    payload.isChecked = true
    state.cartList.push(payload)
  },

  addCart(state, payload) {
    state.cartCount = payload.count
  }
}